﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Practices.ObjectBuilder;
using DemoSupport;

namespace StatusBarDemo
{
	public partial class StatusBarDemoView : DemoViewBase, IStatusBarDemoView
	{
		private StatusBarDemoPresenter _presenter;

		[Dependency]
		public StatusBarDemoPresenter Presenter
		{
			get
			{
				return _presenter;
			}
			set
			{
				_presenter = value;
				_presenter.View = this;
			}
		}

		public ImageSource FirstImage
		{
			get
			{
				return FindResource("FirstImage") as ImageSource;
			}
		}

		public ImageSource SecondImage
		{
			get
			{
				return FindResource("SecondImage") as ImageSource;
			}
		}

		public ImageSource ThirdImage
		{
			get
			{
				return FindResource("ThirdImage") as ImageSource;
			}
		}

		public StatusBarDemoView()
		{
			InitializeComponent();
		}

		#region Example 1

		public static readonly RoutedCommand Example1BeginPrimaryMessageOperation = new RoutedCommand("Example1BeginPrimaryMessageOperation", typeof(StatusBarDemoView));

		public static readonly RoutedCommand Example1ChangePrimaryMessage = new RoutedCommand("Example1ChangePrimaryMessage", typeof(StatusBarDemoView));

		public static readonly RoutedCommand Example1EndPrimaryMessageOperation = new RoutedCommand("Example1EndPrimaryMessageOperation", typeof(StatusBarDemoView));

		public static readonly RoutedCommand Example1BeginSecondaryMessageOperation = new RoutedCommand("Example1BeginSecondaryMessageOperation", typeof(StatusBarDemoView));

		public static readonly RoutedCommand Example1ChangeSecondaryMessage = new RoutedCommand("Example1ChangeSecondaryMessage", typeof(StatusBarDemoView));

		public static readonly RoutedCommand Example1ChangeSecondaryMessageImage = new RoutedCommand("Example1ChangeSecondaryMessageImage", typeof(StatusBarDemoView));
		
		public static readonly RoutedCommand Example1EndSecondaryMessageOperation = new RoutedCommand("Example1EndSecondaryMessageOperation", typeof(StatusBarDemoView));

		private void Example1BeginPrimaryMessageOperation_CanExecute(object sender, CanExecuteRoutedEventArgs e)
		{
			e.CanExecute = Presenter.Example1CanStartPrimaryMessageOperation();
		}

		private void Example1BeginPrimaryMessageOperation_Executed(object sender, ExecutedRoutedEventArgs e)
		{
			Presenter.Example1StartPrimaryMessageOperation();
		}

		private void Example1ChangePrimaryMessage_CanExecute(object sender, CanExecuteRoutedEventArgs e)
		{
			e.CanExecute = Presenter.Example1CanChangePrimaryMessage();
		}

		private void Example1ChangePrimaryMessage_Executed(object sender, ExecutedRoutedEventArgs e)
		{
			Presenter.Example1ChangePrimaryMessage();
		}

		private void Example1EndPrimaryMessageOperation_CanExecute(object sender, CanExecuteRoutedEventArgs e)
		{
			e.CanExecute = Presenter.Example1CanEndPrimaryMessageOperation();
		}

		private void Example1EndPrimaryMessageOperation_Executed(object sender, ExecutedRoutedEventArgs e)
		{
			Presenter.Example1EndPrimaryMessageOperation();
		}

		private void Example1BeginSecondaryMessageOperation_CanExecute(object sender, CanExecuteRoutedEventArgs e)
		{
			e.CanExecute = Presenter.Example1CanStartSecondaryMessageOperation();
		}

		private void Example1BeginSecondaryMessageOperation_Executed(object sender, ExecutedRoutedEventArgs e)
		{
			Presenter.Example1StartSecondaryMessageOperation();
		}

		private void Example1ChangeSecondaryMessage_CanExecute(object sender, CanExecuteRoutedEventArgs e)
		{
			e.CanExecute = Presenter.Example1CanChangeSecondaryMessage();
		}

		private void Example1ChangeSecondaryMessage_Executed(object sender, ExecutedRoutedEventArgs e)
		{
			Presenter.Example1ChangeSecondaryMessage();
		}

		private void Example1ChangeSecondaryMessageImage_CanExecute(object sender, CanExecuteRoutedEventArgs e)
		{
			e.CanExecute = Presenter.Example1CanChangeSecondaryMessageImage();
		}

		private void Example1ChangeSecondaryMessageImage_Executed(object sender, ExecutedRoutedEventArgs e)
		{
			Presenter.Example1ChangeSecondaryMessageImage();
		}

		private void Example1EndSecondaryMessageOperation_CanExecute(object sender, CanExecuteRoutedEventArgs e)
		{
			e.CanExecute = Presenter.Example1CanEndSecondaryMessageOperation();
		}

		private void Example1EndSecondaryMessageOperation_Executed(object sender, ExecutedRoutedEventArgs e)
		{
			Presenter.Example1EndSecondaryMessageOperation();
		}

		#endregion

		#region Example 2

		public static readonly RoutedCommand Example2BeginDeterminateProgressOperation = new RoutedCommand("Example2BeginDeterminateProgressOperation", typeof(StatusBarDemoView));

		public static readonly RoutedCommand Example2IncreaseProgress = new RoutedCommand("Example2IncreaseProgress", typeof(StatusBarDemoView));

		public static readonly RoutedCommand Example2EndDeterminateProgressOperation = new RoutedCommand("Example2EndDeterminateProgressOperation", typeof(StatusBarDemoView));

		public static readonly RoutedCommand Example2BeginIndeterminateProgressOperation = new RoutedCommand("Example2BeginIndeterminateProgressOperation", typeof(StatusBarDemoView));

		public static readonly RoutedCommand Example2EndIndeterminateProgressOperation = new RoutedCommand("Example2EndIndeterminateProgressOperation", typeof(StatusBarDemoView));

		private void Example2BeginDeterminateProgressOperation_CanExecute(object sender, CanExecuteRoutedEventArgs e)
		{
			e.CanExecute = Presenter.Example2CanStartDeterminateProgressOperation();
		}

		private void Example2BeginDeterminateProgressOperation_Executed(object sender, ExecutedRoutedEventArgs e)
		{
			Presenter.Example2StartDeterminateProgressOperation();
		}

		private void Example2IncreaseProgress_CanExecute(object sender, CanExecuteRoutedEventArgs e)
		{
			e.CanExecute = Presenter.Example2CanIncreaseProgress();
		}

		private void Example2IncreaseProgress_Executed(object sender, ExecutedRoutedEventArgs e)
		{
			Presenter.Example2IncreaseProgress();
		}

		private void Example2EndDeterminateProgressOperation_CanExecute(object sender, CanExecuteRoutedEventArgs e)
		{
			e.CanExecute = Presenter.Example2CanEndDeterminateProgressOperation();
		}

		private void Example2EndDeterminateProgressOperation_Executed(object sender, ExecutedRoutedEventArgs e)
		{
			Presenter.Example2EndDeterminateProgressOperation();
		}

		private void Example2BeginIndeterminateProgressOperation_CanExecute(object sender, CanExecuteRoutedEventArgs e)
		{
			e.CanExecute = Presenter.Example2CanStartIndeterminateProgressOperation();
		}

		private void Example2BeginIndeterminateProgressOperation_Executed(object sender, ExecutedRoutedEventArgs e)
		{
			Presenter.Example2StartIndeterminateProgressOperation();
		}

		private void Example2EndIndeterminateProgressOperation_CanExecute(object sender, CanExecuteRoutedEventArgs e)
		{
			e.CanExecute = Presenter.Example2CanEndIndeterminateProgressOperation();
		}

		private void Example2EndIndeterminateProgressOperation_Executed(object sender, ExecutedRoutedEventArgs e)
		{
			Presenter.Example2EndIndeterminateProgressOperation();
		}

		#endregion

		#region Example 3

		public static readonly RoutedCommand Example3BeginLowPriorityMessage = new RoutedCommand("Example3BeginLowPriorityMessage", typeof(StatusBarDemoView));

		public static readonly RoutedCommand Example3BeginNormalPriorityMessage = new RoutedCommand("Example3BeginNormalPriorityMessage", typeof(StatusBarDemoView));

		public static readonly RoutedCommand Example3BeginHighPriorityMessage = new RoutedCommand("Example3BeginHighPriorityMessage", typeof(StatusBarDemoView));

		public static readonly RoutedCommand Example3EndHighPriorityMessage = new RoutedCommand("Example3EndHighPriorityMessage", typeof(StatusBarDemoView));

		public static readonly RoutedCommand Example3EndNormalPriorityMessage = new RoutedCommand("Example3EndNormalPriorityMessage", typeof(StatusBarDemoView));

		public static readonly RoutedCommand Example3EndLowPriorityMessage = new RoutedCommand("Example3EndLowPriorityMessage", typeof(StatusBarDemoView));

		private void Example3BeginLowPriorityMessage_CanExecute(object sender, CanExecuteRoutedEventArgs e)
		{
			e.CanExecute = Presenter.Example3CanStartLowPriorityOperation();
		}

		private void Example3BeginLowPriorityMessage_Executed(object sender, ExecutedRoutedEventArgs e)
		{
			Presenter.Example3StartLowPriorityOperation();
		}

		private void Example3BeginNormalPriorityMessage_CanExecute(object sender, CanExecuteRoutedEventArgs e)
		{
			e.CanExecute = Presenter.Example3CanStartNormalPriorityOperation();
		}

		private void Example3BeginNormalPriorityMessage_Executed(object sender, ExecutedRoutedEventArgs e)
		{
			Presenter.Example3StartNormalPriorityOperation();
		}

		private void Example3BeginHighPriorityMessage_CanExecute(object sender, CanExecuteRoutedEventArgs e)
		{
			e.CanExecute = Presenter.Example3CanStartHighPriorityOperation();
		}

		private void Example3BeginHighPriorityMessage_Executed(object sender, ExecutedRoutedEventArgs e)
		{
			Presenter.Example3StartHighPriorityOperation();
		}

		private void Example3EndHighPriorityMessage_CanExecute(object sender, CanExecuteRoutedEventArgs e)
		{
			e.CanExecute = Presenter.Example3CanEndHighPriorityOperation();
		}

		private void Example3EndHighPriorityMessage_Executed(object sender, ExecutedRoutedEventArgs e)
		{
			Presenter.Example3EndHighPriorityOperation();
		}

		private void Example3EndNormalPriorityMessage_CanExecute(object sender, CanExecuteRoutedEventArgs e)
		{
			e.CanExecute = Presenter.Example3CanEndNormalPriorityOperation();
		}

		private void Example3EndNormalPriorityMessage_Executed(object sender, ExecutedRoutedEventArgs e)
		{
			Presenter.Example3EndNormalPriorityOperation();
		}

		private void Example3EndLowPriorityMessage_CanExecute(object sender, CanExecuteRoutedEventArgs e)
		{
			e.CanExecute = Presenter.Example3CanEndLowPriorityOperation();
		}

		private void Example3EndLowPriorityMessage_Executed(object sender, ExecutedRoutedEventArgs e)
		{
			Presenter.Example3EndLowPriorityOperation();
		}

		#endregion
	}
}
